<div class="g12 nodrop" style="margin-bottom: 43px;">

    <div style="width: 100%;">

        <h3>Pregled medija</h3>
        <p style="line-height: 13px;">Medije su organizovane<br />po direktorijumima</p>



        <div class="ex_highlight_row grid">

            <div id="example_dir" style="display: none;">
                <label >
                    Direktorijum
                    <select name="directory" id="directory" style="color: #555555; line-height: 16px; padding: 3px 0 0 3px; width: 17em;">
                        <option value="0">-- Molim odaberite</option> 
                        <?
                            foreach($directoryMedia as $directory){

                            ?><option value="<?=$directory['id'];?>" <? if(isset($mediadata)){if(($mediadata[0]['directory_id']==$directory['id'])){ echo 'selected=selected';}} ?>><?=$directory['name'];?></option><?

                            }
                        ?>
                    </select>                             
                </label> 

            </div>

            <table class="datatable border" cellpadding="0" cellspacing="0" id="example">

                <thead>                      
                    <tr style="background-image: url(<?=$url?>assets/img/sort_row_bg.gif); background-repeat: repeat-x; background-position: 0 0 ;">
                        <th class="tbleft">Tip</th><th>Naziv</th><th>Slika</th><th>Autor</th><th>Kreirana</th><th>Ažurirana</th><th>Tagovi</th><th>Akcija</th> 
                    </tr>
                </thead>

                <tbody>

                    <?
                        foreach($media as $row){?>

                        <tr>
                            <td style="text-align: center;">
                                <div style="line-height: 0; font-size: 0">
                                    <?
                                        switch ($row['type']){
                                            case 'img': ?> <img src="<?=$url;?>assets/img/img-logo.png" height="23" /> <? break; 
                                            case 'yt': ?> <img src="<?=$url;?>assets/img/yt-logo.png" height="23" /> <? break;
                                            case 'mp3': ?> <img src="<?=$url;?>assets/img/mp3-logo.png" height="23" /> <? break;
                                        }
                                    ?>
                                    
                                </div>
                            </td>
                            <td class="naziv">
                                <? if(strlen($row['name'])>23 ) {echo mb_substr($row['name'], 0, 23, 'UTF-8').'...';}else {echo $row['name'];}?>
                            </td>
                            <td align="left" height="23">
                                <div style="line-height: 0; font-size: 0">
                                    <?
                                        switch ($row['type']){
                                            case 'img': ?> <img src="<?=$url.'tempatt/'.$row['file']?>" height="23" /> <? break;
                                            case 'yt': ?> <img src="http://img.youtube.com/vi/<?=$row['file']?>/0.jpg" height="23" /> <? break;
                                            case 'mp3': ?> <img src="<?=$url;?>assets/img/mp3-logo.png" height="23" /> <? break;
                                            
                                        }
                                    ?>
                                    
                                </div>
                            </td>
                            <td class="autor">
                                <? if(strlen($row['author'])>23 ) {echo mb_substr($row['author'], 0, 23, 'UTF-8').'...';}else {echo $row['author'];}?>
                            </td>
                            <td class="autor"><?= date('d.m.Y H:i',$row['created']);?> h</td>
                            <td class="autor"><? if($row['modified']!=null) echo date('d.m.Y H:i',$row['modified']).' h';?> </td>
                            <td class="autor"> 

                                    <? if(strlen($row['tags'])>23 ) { echo mb_substr($row['tags'], 0, 23, 'UTF-8').'...'; }else { echo $row['tags']; }?>

                            </td>

                            <td class="akcija">
                                <!--<a href="<?=$url?>media/mediapreview?id=<?=$row['id']?>" class="small" id="<?=$row['id']?>">Pogledaj</a> |-->
                                <a href="<?=$url?>media/editform?id=<?=$row['id']?>&type=<?=$row['type']?>" class="small" id="<?=$row['id']?>">Uredi</a> |
                                <a href="javascript:" class="deletemedia small" id="<?=$row['id']?>">Obriši</a>
                            </td> 
                        </tr>    

                        <?}

                    ?>

                </tbody>

            </table>

        </div>

    </div>

</div>

<style>
    table td, table td.naziv{
        text-align: left; vertical-align: middle; line-height: 11px; padding: 3px 3px;
    }
    table td, table td.autor{
        text-align: left; vertical-align: middle;
    }
    table td, table td.akcija{
        vertical-align: middle;
    }
</style>
<script type="text/javascript">

</script>